apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: prometheus-pvc-cleanup 
  namespace: kubesphere-monitoring-system
spec:
  schedule: "{{ prometheus_system_pvc_cleanup_schedule }}"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: prometheus-pvc-cleanup
            image: kubesphere/ks-installer:v2.1.1
            command: ['sh', '-c', 'kubectl -n kubesphere-monitoring-system delete pvc prometheus-k8s-system-db-prometheus-k8s-system-0 prometheus-k8s-system-db-prometheus-k8s-system-1']
          restartPolicy: OnFailure
          serviceAccountName: prometheus-operator